/**
 * CitizenCard.com Inc.
 * Copyright (c) 2004-2017 All Rights Reserved.
 */
package com.binguo.thirdPay.hzShiMing;


/**
 * RestTemplate 测试类
 * @author liuzq
 * @version $Id: RestTemplateTest.java, v 0.1 2017年3月31日 下午2:32:32 liuzq Exp $
 */
/*@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SpringBootLearnApplication.class)
@WebAppConfiguration //web层要加*/
public class RestTemplateTest {
/*
    @Autowired
    private RestTemplate restTemplate;

    @Test
    public void testRestPost() throws Exception {
        //post json
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
        headers.setAccept(Lists.newArrayList(MediaType.APPLICATION_JSON));
        Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
        String reqSeq = System.currentTimeMillis() + "";
        //请求接口实际数据
        Map<String, String> messageMap = new HashMap<>();
        messageMap.put("psnId", "141585773230231");
        messageMap.put("cardNo", "6222021202038149400");
        messageMap.put("idNo", "340323199009180459");
        messageMap.put("name", "王浩");
        messageMap.put("mobile", "15267182670");
        messageMap.put("reqSeq", reqSeq);
        messageMap.put("national", "中国");
        messageMap.put("gender", "M");
        messageMap.put("address", "中国杭州近江时代大厦");
        messageMap.put("certValidEndDate", "2027-04-23");
        String messageMapStr = gson.toJson(messageMap);
        //请求开放平台数据
        Map<String, String> openMap = new HashMap<>();
        openMap.put("reqSeq", reqSeq);
        openMap.put("appId", "10001");
        openMap.put("method", "smkCounterRecord");
        openMap.put("bizContent", messageMapStr);
        openMap.put("sign_param", "appId,method,bizContent");
        //加签
        openMap.put("sign", RSAUtil.rsaSign(openMap));
        String message = gson.toJson(openMap);
        HttpEntity<String> entity = new HttpEntity<String>(message, headers);
        String urlstr = "http://192.168.23.238:8088/gateway";
        ResponseEntity<String> resp = restTemplate.postForEntity(urlstr, entity, String.class);
        String result = resp.getBody();
        JSONObject json = JSONObject.fromObject(result);
        //验签
        Map<String, String> checkMap = new HashMap<>();
        checkMap.put("reqSeq", reqSeq);
        checkMap.put("sign_param", "success,value");
        checkMap.put("success", json.getString("success"));
        checkMap.put("value", json.getString("value"));
        checkMap.put("sign", json.getString("sign"));
        System.out.println(RSAUtil.rsaCheck(checkMap));
    }
*/
}
